package com.sikaryofficial.workbench.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author : wuweihong
 * @desc : 订单头状态枚举
 * @date : 2024-09-24
 */
@Getter
@AllArgsConstructor
public enum OrderHeaderStatusEnum {

    /**
     * 需求待确认状态时，需要销售和客户对定制单进行确认
     */
    DRAFT(0, "需求待确认", "Your demands are being Confirmed"),
    /**
     * 等待销售报价，销售可见并对子订单报价
     */
    WAITING_CONFIRMATION(1, "订单确认", "Order Confirmation "),
    /**
     * 报价完成，合同签署中,所有子订单确认完成，进入合同签署中的状态
     */
    PREPARE(2, "备料及排产", "Prepare"),
    /**
     * 合同签署完成后，等待支付定金。渠道商支付定金，销售上传支付凭证
     */
    PENDING_DELIVERY(3, "待发货", "Pending Delivery"),
    SHIPPED(4, "已发货", "Shipped"),
    /**
     * 定金支付完成，各个子订单开始准备生产
     */
    ORDER_COMPLETED(5, "完成", "Order completed"),
    /**
     * 拒绝订单
     */
    REJECTED(8, "订单已拒绝", "Rejected")
    ;

    private final Integer code;
    private final String descCn;
    private final String desc;


    public static OrderHeaderStatusEnum getOrderHeaderStatusByCode(Integer code) {
        return Arrays.stream(values())
                .filter(status -> status.getCode().equals(code))
                .findFirst().orElse(null);
    }


}
